<template>
  <div>
    <!--车辆选择 2018/9/3 11:44 zuoW -->
    <!--<Select-->
    <!--v-model="selectTruck"-->
    <!--filterable-->
    <!--remote @on-change="selectData">-->
    <!--<Option v-for="(option, index) in truckList" :value="option.truck_no" :key="index">{{option.truck_no}}</Option>-->
    <!--</Select>-->
    <Select v-model="selectTruck" filterable clearable>
      <template v-for="(item,index) in truckList">
        <Option :value="item.truck_no" :key="item.truck_no">{{ item.truck_no }}</Option>
      </template>
    </Select>
  </div>
</template>

<script>
  import _ from 'lodash'

  export default {
    name: 'complete',
    data () {
      let selectTruck = ''
      let datas = {selectTruck}
      return datas
    },
    props: {
      truckList: {
        type: Array,
        default () {
          return []
        }
      },
      nowTruck: {
        type: String,
        default () {
          return ''
        }
      }
    },
    computed: {},
    methods: {},
    created () {
    },
    mounted () {
      this.selectTruck = this.nowTruck
    },
    watch: {
      'selectTruck': {
        handler: function (oldVal, newVal) {
          let dataList = _.find(this.truckList, (item) => {
            return item.truck_no === this.selectTruck
          })
          this.$emit('truckSelectCurrent', dataList)
        },
        deep: true
      }
    },
    components: {}
  }
</script>

<style scoped>

</style>
